const webpack = require('webpack')

module.exports = {
    publicPath:'/',
    lintOnSave: false, // 关闭eslint
    productionSourceMap: false,  //去掉打包的时候生成的map文件
    outputDir: 'dist',//打包后的目录名称
    assetsDir: 'static',//静态资源目录名称
    chainWebpack: config => {
        config.plugin('provide').use(webpack.ProvidePlugin, [{
            $: 'jquery',
            jquery: 'jquery',
            jQuery: 'jquery',
            'window.jQuery': 'jquery'
        }]),
        {
            test: /\.jpg|png|gif|bmp|ttf|eot|svg|woff|woff2$/,
            use:[
                {
                    loader: 'url-loader',
                    option: {
                        limit: 16940,
                        fallback:{
                            loader: 'file-loader',
                            options: {
                                name:'fonts/[name].[hash.8].[ext]'
                            }
                        }
                    }
                }
            ]
        }
    },
    devServer: {
        open: true, // 自动打开浏览器
        host: 'localhost', // 允许外部ip访问
        port: 9099, // 端口
        https: false, // 启用https
        overlay: {
            warnings: true,
            errors: true
        },
    }
}